package com.bookRecommend.commons;

import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Utils {

    public static String encode(String pass) {
        try {
            byte[] bs = MessageDigest.getInstance("md5").digest(pass.getBytes(StandardCharsets.UTF_8));
            return new BigInteger(1, bs).toString(16);
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }

}
